from typing import AsyncIterator, Any

import scrapy


class QutotesSpider(scrapy.Spider):
    name = "quotes"
    # allowed_domains = ["baidu.com"]
    start_urls = ["https://quotes.toscrape.com"]


    async def start(self):
        for url in self.start_urls:
            yield scrapy.Request(url=url)

    def parse(self, response):
        # print(response.text)
        h1 = response.css('.header-box div h1')
        a = h1.css('a::text').get()
        a_url = h1.css('a::attr(href)').get()
        print(a,a_url)
